Imports Microsoft.Reporting.WinForms
Imports DoAnQuanLyBanHang1065043_1065007.DoAnQuanLyBanHang.BUSS
Imports DoAnQuanLyBanHang1065043_1065007.DoAnQuanLyBanHang.DAO
Imports DoAnQuanLyBanHang1065043_1065007.DoAnQuanLyBanHang.General

Public Class frmDoanhThu
    Private m_DoanhThuCtrl As New DoanhThuCtrl()
    Public Sub New()
        InitializeComponent()
        DataService.OpenConnection()
    End Sub

    Private Sub frmDoanhThu_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        m_DoanhThuCtrl.HienThiComboBox(cmbThang)
        m_DoanhThuCtrl.HienThiComboBox1(cmbNam)
        Me.ReportViewerDoanhThu.RefreshReport()

        Me.ReportViewerDoanhThu.RefreshReport()
    End Sub

    Private Sub btnThoat_Click(sender As System.Object, e As System.EventArgs) Handles btnThoat.Click
        Me.Close()
    End Sub

    Private Sub btnTruyXuat_Click(sender As System.Object, e As System.EventArgs) Handles btnTruyXuat.Click
        Dim ketqua As IList(Of DoanhThuInfo) = DoanhThuCtrl.LayDsDoanhThuTheoThang(Convert.ToInt32(cmbThang.SelectedValue), Convert.ToInt32(cmbNam.SelectedValue))

        Dim param As IList(Of ReportParameter) = New List(Of ReportParameter)()
        param.Add(New ReportParameter("Ngay", DateTime.Today.Day & "/" & DateTime.Today.Month & "/" & DateTime.Today.Year))

        Me.ReportViewerDoanhThu.LocalReport.SetParameters(param)
        Me.DoanhThuBindingSource.DataSource = ketqua
        Me.ReportViewerDoanhThu.RefreshReport()

    End Sub

End Class